using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Models
{
    /// <summary>
    /// 权限实体类，定义系统中的权限项
    /// </summary>
    public class Permission
    {
        /// <summary>
        /// 构造函数，初始化角色权限集合
        /// </summary>
        public Permission()
        {
            RolePermissions = new List<RolePermission>();
        }

        /// <summary>
        /// 权限ID，主键
        /// </summary>
        public int PermissionId { get; set; }

        /// <summary>
        /// 权限名称，必填
        /// 格式通常为："{资源}:{操作}"，如"Users:View"
        /// </summary>
        [Required]
        public string PermissionName { get; set; } = null!;

        /// <summary>
        /// 权限描述，可选
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 角色权限关联集合，表示拥有此权限的所有角色
        /// </summary>
        public virtual ICollection<RolePermission> RolePermissions { get; set; }
    }
} 